<?php
    
// Problem array[0] in einem JavaScript !!!!!!!!!!!!!!!!!!!!!!!!!!

// replace Array
//$fieldList = regex::getRegexTable("\[([^'\.]*?)\]", $html); f?r was war der Punkt
$fieldList=regex::getRegexTable("\[([^':\"\$]+?)\]", $body);
//$queryCounter = $e->data_var;

foreach ($fieldList as $field)
    {

          $dbField=$field[1];    
        
    // if (db::tableFieldExist($tableField, $field[$n][1])) {
    //if (in_array($field[1], $tableFieldList)) {
    //echo $field[1];

  /*  $fieldArray = explode(".", $field[1]);

    //echo $field[1];
    //print_r($fieldArray);

    if (sizeof($fieldArray) == 1)
        {
        $tableField="";
        $dbField=$fieldArray[0];
        }

    if (sizeof($fieldArray) == 2)
        {
        $tableField=$fieldArray[0];
        $dbField=$fieldArray[1];
        }  */


// welche probleme, falls keine abfrage???
//  if ((db::getValue("SELECT COUNT(1) FROM _table_field WHERE field='$dbField'") > 0) or ($dbField == "id") or ($dbField == "id2")) {
    //$queryCounter=$tableField;


    // nur ersetzen, falls Tabellen Feld vorhanden ist
    //if (db::fieldExist($item->table, $dbField))
      //  {

          //  echo "$dbField exist";

        //if ($modus == "html")
        $replacePhp='<?php echo $mysqlItem["' . strtolower($dbField) . '"];?>';

        /*if ($modus == "php")
            $replacePhp='{$dataquery_' . $queryCounter . '["' . strtolower($dbField) . '"]}';


        //innerhalb von PHP Code
        $replacePhp2='{$dataquery_' . $queryCounter . '["' . strtolower($dbField) . '"]}'; */

        $body=str_ireplace($field[0], $replacePhp, $body);
        //} 

    }


?>   